<!DOCTYPE html>
<html class="x-admin-sm" xmlns="http://www.w3.org/1999/html">

<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!--    打印小票代码-->
    <script language="javascript">
        function preview(oper) {
            if (oper < 10) {
                bdhtml = window.document.body.innerHTML; //获取当前页的html代码
                sprnstr = "<!--startprint" + oper + "-->"; //设置打印开始区域
                eprnstr = "<!--endprint" + oper + "-->"; //设置打印结束区域
                prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18); //从开始代码向后取html
                prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr)); //从结束代码向前取html
                window.document.body.innerHTML = prnhtml;
                window.print();
                window.document.body.innerHTML = bdhtml;
            } else {
                window.print();
            }
        }
    </script>
</head>
<style>
    body{
        /*对整个页面进行样式的修饰*/
        margin: 0 auto;
        width: 313px;
        font-size: 10px;  /*字体大小*/
    }
    /*对单独的样式进行设置*/
    hr{
        /*solid：实线 dashed：虚线*/
        border: 0.5px dashed;
    }
    .place{
        font-size: 24px;
        font-weight: bold;
    }
    .note{
        padding-top: 20px;
        padding-bottom: 20px;
    }
    .picture{
        margin-left: 70px;
        margin-bottom: 20px;
    }
    .layui-row {
        text-align: center;
    }
</style>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <!--startprint1-->
            <div style="text-align: center;">送餐到桌顾客联</div>
            <div class="place" style="text-align: center;">请留意您的账单号</div>
            <div style="text-align: center;">小耳奶茶店</div>
            <div style="text-align: center;">010-123456789</div>
            <div style="text-align: center;">--结账单--</div>
            <div class="place" style="text-align: center;">订单编号：B000<?php echo $order['order_id']; ?></div>
            <div style="text-align: center;">账单类型：堂食</div>
            <div style="text-align: center;">桌号：<?php echo $order['user_table']; ?></div>
            <div style="text-align: center;">收银员：<?php echo session('admin_name'); ?></div>
            <div style="text-align: center;">开单时间：<?php echo date("Y-m-d H:i:s", $order['add_time']); ?></div>
            <div style="text-align: center;">结账时间：<?php echo date("Y-m-d H:i:s", $order['add_time']); ?></div>
            <!-- hr为分割线 -->
            <hr/>
            <table>
                <tr>
                    <td width="50" align="center">品项</td>
                    <td width="190" align="center">&nbsp;&nbsp;金额</td>
                    <td width="50" align="center">&nbsp;&nbsp;&nbsp;数量</td>

                </tr>
                <?php foreach ($detail as $item): ?>
                <tr>
                    <td valign="top" align="center"><?php echo $item['ware_name']; ?></td>
                    <td align="center">&nbsp;&nbsp;￥<?php echo $item['ware_price']; ?><br>
                    </td>
                    <td valign="top" align="right"><?php echo $item['ware_num']; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                </tr>
                <?php endforeach; ?>
            </table>
            <hr/>
            <table>
                <tr>
                    <td width="246" align="left">&nbsp;&nbsp;合计</td>
                    <td width="50" align="right">￥<?php echo $order['order_price']; ?>&nbsp;&nbsp;</td>
                </tr>
                <tr>
                    <td align="left">&nbsp;&nbsp;微支付</td>
                    <td align="right">￥<?php echo $order['order_price']; ?>&nbsp;&nbsp;</td>
                </tr>
            </table>
            <hr/>
            <div align="center">打印时间：<?php echo date("Y-m-d H:i:s", $order['add_time']); ?></div>
            <hr />
            <div class="note" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;根据相关税法规定，电子发票的开票日期同网上申请电子发票的日期，如您需要当日的电子发票请务必在消费当日通过扫描下方二维码，根据指引步骤开具您的增值税电子普通发票。此二维码30天有效，扫描时请保持小票平整。</div>
            <!--            <div class="picture"><img src="./image/picture.png" width="150px"/></div>-->
            <div style="text-align: center;">官网：www.order.xiaxueruo.com</div>
            <div style="text-align: center;">加盟热线：86-21-123456789或86-22-123456789</div><br>
            <!--endprint1-->

            <button name="button_export" onclick="preview(1)" class="layui-btn" lay-filter="add">打印</button>


        </form>
    </div>
</div>

</body>

</html>